Getting started: Fix a corner case
authorMatthias Clasen <mclasen@redhat.com>
Wed, 24 Jul 2013 00:18:54 +0000 (20:18 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 24 Jul 2013 11:31:05 +0000 (07:31 -0400)
When using 'Words' without a loaded document, the example
would crash. Thats not nice, so avoid it.

examples/application8/exampleappwin.c

index d3f1cc5f8c1bf5321c2d08e243015873b964686a..ea826166c6586abe0c05a9b45c281b5591aa3782 100644 (file)
@@ -89,6 +89,10 @@ update_words (ExampleAppWindow *win)
   priv = example_app_window_get_instance_private (win);
 
   tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
+
+  if (tab == NULL)
+    return;
+
   view = gtk_bin_get_child (GTK_BIN (tab));
   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));